import os
import pickle


# 创建文件夹
def create_folder():
    path = "/Users/liuqingyuan/Downloads/pythonFolder"
    os.makedirs(path)
    print("文件夹创建成功")


# 读取文件
def readfile():
    file = open(r'/Users/liuqingyuan/Downloads/iosUpdateInfo.txt')
    print(file.read())
    file.close()


# 创建文件
def create_file():
    file = open('/Users/liuqingyuan/Downloads/python.txt', 'w')
    file.close()
    print("创建文件")


# 写入文件
def write_to_file():
    file = open('/Users/liuqingyuan/Downloads/python.txt', 'w')
    file.write("hello")
    file.write("\n")
    file.write("world")
    file.close()
    print("文件写入成功")


# 序列化和反序列化
def pickle_demo():
    # 序列化
    str = pickle.dumps("hello Tom")
    # 反序列化
    str = pickle.loads(str)
    print(str)
